// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


/**
 * @fileoverview Unit tests for bite.layer.soy.Config.
 * TODO (jasonstredwick): Rework this unit test.
 *
 * @author jasonstredwick@google.com (Jason Stredwick)
 */


goog.require('bite.common.test_framework.SoyTests');
goog.require('bite.layer.Config');
goog.require('bite.layer.soy.Config');


function setUp() {}


function tearDown() {}


/**
 * Test behaviors.
 */
function testBehavior() {
  var obj = new bite.layer.Config();
  assertTrue(obj.init(''));
  assertTrue(obj.isInitialized());

  assertTrue(obj.isDisabled());
  obj.enable();
  assertFalse(obj.isDisabled());

  assertFalse(obj.isVisible());
  obj.show();
  assertTrue(obj.isVisible());
  obj.hide();
  assertFalse(obj.isVisible());

  // Clean up
  obj.undoSetup_();
}


/**
 * Test bite.layer.soy.Config.getView.
 */
function testGetView() {
  var tests = bite.common.test_framework.SoyTests.getInstance();
  var template = bite.layer.soy.Config.getView;
  var tag = 'href';

  var expectedValue = 'styles/config.css';
  var url = '';
  tests.testAttributeValue(assertEquals, expectedValue, tag, template,
      {baseUrl: url});

  tests.testAttributeValue(assertEquals, expectedValue, tag, template, {});

  url = 'http://www.google.com/';
  expectedValue =
      'http://www.google.com/styles/config.css';
  tests.testAttributeValue(assertEquals, expectedValue, tag, template,
      {baseUrl: url});
}

